package com.whp.openapi.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

public class UserToken implements Serializable {
    private Integer id;

    private Integer appid;

    private Integer cusid;

    private String accessToken;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") //格式化前端的传入的时间格式
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") //格式化后端返回的时间格式，校准时间为东八区（GMT+8）
    private Date expiretime;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date starttime;

    private static final long serialVersionUID = 1L;

    public UserToken(Integer id, Integer appid, Integer cusid, String accessToken, Date expiretime, Date starttime) {
        this.id = id;
        this.appid = appid;
        this.cusid = cusid;
        this.accessToken = accessToken;
        this.expiretime = expiretime;
        this.starttime = starttime;
    }

    public UserToken() {
        super();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getAppid() {
        return appid;
    }

    public void setAppid(Integer appid) {
        this.appid = appid;
    }

    public Integer getCusid() {
        return cusid;
    }

    public void setCusid(Integer cusid) {
        this.cusid = cusid;
    }

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken == null ? null : accessToken.trim();
    }

    public Date getExpiretime() {
        return expiretime;
    }

    public void setExpiretime(Date expiretime) {
        this.expiretime = expiretime;
    }

    public Date getStarttime() {
        return starttime;
    }

    public void setStarttime(Date starttime) {
        this.starttime = starttime;
    }
}